/**
 * Authorizer
 *
 * Copyright 2016 by Tjado Mäcke <tjado></tjado>@maecke.de>
 * Licensed under GNU General Public License 3.0.
 *
 * @license GPL-3.0 <https:></https:>//opensource.org/licenses/GPL-3.0>
 */
package com.seuic.hid_demo.util.hid

import java.util.*

abstract class UsbHidKbd {
    protected var kbdVal: MutableMap<String?, ByteArray> = HashMap()

    init {
        kbdVal["ctrl"] = byteArrayOf(0x01, 0x00)
        kbdVal["shift"] = byteArrayOf(0x02, 0x00)
        kbdVal["alt"] = byteArrayOf(0x04, 0x00)
        kbdVal["caps"] = byteArrayOf(0x00, 0x39)
        kbdVal["tab"] = byteArrayOf(0x00, 0x2b)
    }

    fun getScancode(key: String?): ByteArray {
        return kbdVal[key]
            ?: throw NoSuchElementException("Scancode for '" + key + "' not found (" + kbdVal.size + ")")
    }
}